package com.zrwl.poscloud.xo.mapper;

import com.zrwl.poscloud.base.entity.ServerSyncEmployeeInfo;
import com.zrwl.poscloud.base.superI.SuperMapper;
import com.zrwl.poscloud.xo.vo.EmployeeVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 用户关注持卡人云端数据 Mapper类
 *
 * @author 刘思童 AutoGenerate
 * @date 2022-03-30
 */
public interface ServerSyncEmployeeInfoMapper extends SuperMapper<ServerSyncEmployeeInfo> {

    @Select("<script>" +
            " SELECT a.uid,a.name employeeName,a.cert_code certCode,a.sex,a.employee_code employeeCode,a.type,a.is_vip,b.name deptName, " +
            " b.company_uid,c.full_name companyFullName,substr(c.company_code,1,5)companyCode " +
            " FROM t_employee a LEFT JOIN t_dept b ON a.company_code=b.company_code LEFT JOIN t_company c ON b.company_uid=c.uid " +
            " WHERE a.uid=#{uid} " +
            "</script>"
    )
    public EmployeeVO getSyncEmployeeData(@Param("uid") String employeeUid);
}
